package com.pie4cloud.pie.job.api.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.pie4cloud.pie.common.mybatis.base.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;


/**
 * @program: sod
 * @description:
 * @author: zzj
 * @create: 2019-12-18 17:15
 **/

@Data
@Entity
@Table(name="T_DATA_JOB_INFO")
@Inheritance(strategy= InheritanceType.JOINED)
@DiscriminatorColumn(name="type")
@DiscriminatorValue("JOB")
public class JobInfoEntity extends BaseEntity {
	@Id
	@Column(name = "ID",length = 255)
	@TableId(value = "id", type = IdType.ASSIGN_ID)
	@GenericGenerator(name="snowflakeId", strategy="com.pie4cloud.pie.jpa.id.GenerateSnowflakeId")
	@GeneratedValue(generator="snowflakeId")
	@ApiModelProperty(value="id")
	private Long id;
    @Column(name="job_group", length=50)
    private String jobGroup;		// 执行器主键ID
    @Column(name="job_cron", length=255)
    private String jobCron;		// 任务执行CRON表达式
    @Column(name="job_desc", length=255)
    private String jobDesc;
    @Column(name="task_name", length=255)
    private String taskName;
    @Column(name="executor_route_strategy", length=50)
    private String executorRouteStrategy;	// 执行器路由策略
    @Column(name="executor_handler", length=255)
    private String executorHandler;		    // 执行器，任务Handler名称
    @Column(name="executor_param", columnDefinition = "CLOB")
    private String executorParam;		    // 执行器，任务参数
    @Column(name="executor_block_strategy", length=50)
    private String executorBlockStrategy;	// 阻塞处理策略
    @Column(name="executor_timeout", length=50)
    private Integer executorTimeout;     		// 任务执行超时时间，单位秒
    @Column(name="executor_fail_retry_count", length=50)
    private Integer executorFailRetryCount;		// 失败重试次数
    @Column(name="retry_interval", length=50)
    private Integer retryInterval;
    @Column(name="trigger_status", length=50)
    private Integer triggerStatus;		// 调度状态：0-停止，1-运行
    @Column(name="trigger_last_time", length=50)
    private long triggerLastTime;	// 上次调度时间
    @Column(name="trigger_next_time", length=50)
    private long triggerNextTime;	// 下次调度时间
    @Column(name="is_alarm", length=1)
    private String isAlarm;		// 是否告警
    @Transient
    private String type;		// 执行器主键ID
    @Transient
    private String executorAddress;

	@Column(name="cons_id", length=50)
	private Long consId;

	@Column(name="delay_time")
	private long delayTime=0;//延时调度时间

}

